
function checkNum(obj){
    obj.value = obj.value.replace(/\.$/g,""); 
}


 function clearNoNum(event,obj){ 
     //响应鼠标事件，允许左右方向键移动 
     event = window.event||event; 
     if(event.keyCode == 37 | event.keyCode == 39){ 
         return; 
     } 
     //先把非数字的都替换掉，除了数字和. 
     obj.value = obj.value.replace(/[^\d.]/g,""); 
     //必须保证第一个为数字而不是. 
     obj.value = obj.value.replace(/^\./g,""); 
     //保证只有出现一个.而没有多个. 
     obj.value = obj.value.replace(/\.{2,}/g,"."); 
     //保证.只出现一次，而不能出现两次以上 
     obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$","."); 
 } 
function serializeForm(form) {  
    var fElements = form.elements  
            || (document.forms[form] || Ext.getDom(form)).elements, hasSubmit = false, encoder = encodeURIComponent, element, options, name, val, data = {}, type;  
    Ext.each(fElements, function(element) {  
        name = element.name;  
        type = element.type;  
        if (!element.disabled && name) {  
            if (/select-(one|multiple)/i.test(type)) {  
                Ext.each(element.options, function(opt) {  
                            if (opt.selected) {
                                data[encoder(name)] = encoder((opt.hasAttribute  
                                        ? opt.hasAttribute('value')  
                                        : opt.getAttribute('value') !== "")  
                                        ? opt.value  
                                        : opt.text);  
                            }  
                        });  
            } else if (!/file|undefined|reset|button/i.test(type)) {
           
                if (!(/radio|checkbox/i.test(type) && !element.checked)  
                        && !(type == 'submit' && hasSubmit)) {  
                        if(element.value!=""){
                          data[encoder(name)] = encoder(element.value);  
                          hasSubmit = /submit/i.test(type);  
                    }
                }  
            }  
        }  
    });  
    return data;  
} 